package cn.fengsweb.tokyotyrant
{
	public class TokyoTyrantTable
	{
		public static var host:String;
		public static var port:uint;
		
		public static function query(ttq:TokyoTyrantQuery, ttr:TokyoTyrantResponder):void
		{
			var handler:QueryHandler	= new QueryHandler(host, port);
				handler.connect(ttq, ttr);
		}
		
		public static function getOne(key:String, ttr:TokyoTyrantResponder):void
		{
			var send:GetOne				= new GetOne(key);
			var handler:GetOneHandler	= new GetOneHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function getMore(keyArray:Array, ttr:TokyoTyrantResponder):void
		{
			var send:GetMore			= new GetMore(keyArray);
			var handler:GetMoreHandler	= new GetMoreHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function putOneNoKey(obj:Object, ttr:TokyoTyrantResponder=null):void
		{
			var send:PutOneNoKey			= new PutOneNoKey(obj);
			var handler:PutOneNoKeyHandler	= new PutOneNoKeyHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function putMoreNoKey(valueArray:Array, ttr:TokyoTyrantResponder=null):void
		{
			var send:PutMoreNoKey			= new PutMoreNoKey(valueArray);
			var handler:PutMoreNoKeyHandler	= new PutMoreNoKeyHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function putOne(key:String, obj:Object, ttr:TokyoTyrantResponder=null):void
		{
			var send:PutOne				= new PutOne(key, obj);
			var handler:PutOneHandler	= new PutOneHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function putMore(keyValueArray:Array, ttr:TokyoTyrantResponder=null):void
		{
			var send:PutMore			= new PutMore(keyValueArray);
			var handler:PutMoreHandler	= new PutMoreHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function outOne(key:String, ttr:TokyoTyrantResponder=null):void
		{
			var send:OutOne				= new OutOne(key);
			var handler:OutOneHandler	= new OutOneHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function outMore(keyArray:Array, ttr:TokyoTyrantResponder=null):void
		{
			var send:OutMore			= new OutMore(keyArray);
			var handler:OutMoreHandler	= new OutMoreHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function stat(ttr:TokyoTyrantResponder):void
		{
			var send:Stat				= new Stat();
			var handler:StatHandler		= new StatHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function vanish(ttr:TokyoTyrantResponder):void
		{
			var send:Vanish				= new Vanish();
			var handler:VanishHandler	= new VanishHandler(host, port);
				handler.connect(send, ttr);
		}
		
		public static function setIndex(key:String, tokyoTyrantSetIndexType:uint, ttr:TokyoTyrantResponder=null):void
		{
			var send:SetIndex			= new SetIndex(key, tokyoTyrantSetIndexType);
			var handler:SetIndexHandler	= new SetIndexHandler(host, port);
				handler.connect(send, ttr);
		}
	}
}